/********************************************************************
	Rhapsody	: 7.5 
	Login		: KBE
	Component	: DefaultComponent 
	Configuration 	: CodeConfig
	Model Element	: EventHandler
//!	Generated Date	: Fri, 7, Sep 2012  
	File Path	: DefaultComponent\CodeConfig\EventHandler.cpp
*********************************************************************/

//## auto_generated
#include "EventHandler.h"
//## operation getHandle() const
#include "EHANDLE.h"
//## link itsReactor
#include "Reactor.h"
//## package Default

//## class EventHandler
EventHandler::EventHandler() {
    itsEHANDLE = NULL;
    itsReactor = NULL;
}

EventHandler::~EventHandler() {
    cleanUpRelations();
}

EHANDLE* EventHandler::getHandle() const {
    //#[ operation getHandle() const
    return itsEHANDLE;
    //#]
}

void EventHandler::createHandle() {
    //#[ operation createHandle()
    itsEHANDLE = new EHANDLE();
    //#]
}

EHANDLE* EventHandler::getItsEHANDLE() const {
    return itsEHANDLE;
}

Reactor* EventHandler::getItsReactor() const {
    return itsReactor;
}

void EventHandler::cleanUpRelations() {
    if(itsEHANDLE != NULL)
        {
            itsEHANDLE = NULL;
        }
    if(itsReactor != NULL)
        {
            Reactor* current = itsReactor;
            if(current != NULL)
                {
                    current->_removeItsEventHandler(eventType);
                }
            itsReactor = NULL;
        }
}

void EventHandler::__setItsReactor(Reactor* p_Reactor) {
    itsReactor = p_Reactor;
}

void EventHandler::_setItsReactor(Reactor* p_Reactor) {
    if(itsReactor != NULL)
        {
            itsReactor->_removeItsEventHandler(this);
        }
    __setItsReactor(p_Reactor);
}

void EventHandler::_clearItsReactor() {
    itsReactor = NULL;
}

void EventHandler::setEventType(Event_Type p_eventType) {
    eventType = p_eventType;
}

/*********************************************************************
	File Path	: DefaultComponent\CodeConfig\EventHandler.cpp
*********************************************************************/
